//package com.gist.cithub.gateway.config;
//
//import com.gist.cithub.gateway.feign.UserFeignService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.HttpMethod;
//import org.springframework.security.authentication.AuthenticationManager;
//import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.crypto.password.NoOpPasswordEncoder;
//import org.springframework.security.crypto.password.PasswordEncoder;
//
//@Configuration
//@EnableWebSecurity
//public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
//
//  @Autowired
////  private UserFeignService userDetailsService;
//
//
//  @Override
//  protected void configure(AuthenticationManagerBuilder auth)
//		  throws Exception {
//	auth.authenticationProvider(authenticationProvider());
//  }
//
//  @Bean
//  public DaoAuthenticationProvider authenticationProvider() {
//	DaoAuthenticationProvider authProvider
//			= new DaoAuthenticationProvider();
////	authProvider.setUserDetailsService(userDetailsService);
//	authProvider.setPasswordEncoder(passwordEncoder());
//	return authProvider;
//  }
//
//  @Bean
//  public PasswordEncoder passwordEncoder() {
//	return NoOpPasswordEncoder.getInstance();
//  }
//
//  /*
//  @Bean
//  @Override
//  protected UserDetailsService userDetailsService(){
//	// JdbcDaoImpl
//	InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
//	manager.createUser(User.withUsername("user_1").password("123456").authorities("USER").build());
//	manager.createUser(User.withUsername("user_2").password("123456").authorities("USER").build());
//	return manager;
//  }
//*/
//  @Override
//  protected void configure(HttpSecurity http) throws Exception {
//	// @formatter:off
//	/*http
//			.requestMatchers().anyRequest()
//			.and()
//			.authorizeRequests()
//			.antMatchers("/oauth/*").permitAll();*/
//	http.requestMatchers().antMatchers(HttpMethod.OPTIONS, "/oauth/token", "/**")
//			.and()
//			.csrf().disable();
//	// @formatter:on
//  }
//
//  @Override
//  @Bean
//  public AuthenticationManager authenticationManagerBean() throws Exception {
//	return super.authenticationManagerBean();
//  }
//
//  /*@Bean
//  PasswordEncoder passwordEncoder(){
//	return NoOpPasswordEncoder.getInstance();
//  }*/
///*
//  @Bean
//  PasswordEncoder passwordEncoder(){
//	return new BCryptPasswordEncoder();
//  }
//
//
//  String finalPassword = new BCryptPasswordEncoder().encode("123456");
//  String finalSecret = new BCryptPasswordEncoder().encode("123456");
//*/
//}
